﻿using JESAI.EventBus.Attributes;
using JESAI.EventBus.Contexts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;

namespace JESAI.EventBus.Events
{
    public class SubscribeEvent : IEvent
    {
        public SubscribeEvent(string eventId, EventSubscribeType subscribeType)
        {
            EventId = eventId;
            SubscribeType = subscribeType;
        }

        public string EventId { get; set; }
        public Func<EventExecutingContext, Task> Handle { get; set; }
        public EventSubscribeAttribute Attribute { get; set; }
        public object Payload { get; set; }

        public DateTime CreatedTime { get; set; }

        public CancellationToken CancellationToken { get; set; }

        public bool IsConsumOnce { get; set; }

        public MethodInfo HandleMethod { get; set; }

        public bool AllowMultiConsum => throw new NotImplementedException();

        public EventSubscribeType SubscribeType { get; set; }
    }

    public enum EventSubscribeType
    {
        Subscribe,
        Unsubscribe
    }
}
